from django.db import models
from django.contrib.auth.models import User


# Create your models here.

class Grade(models.Model):
    gradename = models.CharField(max_length=255)
    gradeurl = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = 'grade'
        app_label = "StudyPlatform"


class Courses(models.Model):
    coursename = models.CharField(max_length=255)
    grade = models.ForeignKey(Grade)
    videourl = models.CharField(max_length=255)
    videoname = models.CharField(max_length=255)
    imgurl = models.CharField(max_length=255)
    courseurl = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = "courses"
        app_label = "StudyPlatform"


class CourseVideos(models.Model):
    courses = models.ForeignKey(Courses)
    videoname = models.CharField(max_length=255)
    videourl = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = "course_videos"
        app_label = "StudyPlatform"


class UserComment(models.Model):
    user = models.ForeignKey(User)
    words = models.TextField()
    courses = models.ForeignKey(Courses)
    commenttime = models.DateTimeField()

    class Meta:
        managed = False
        db_table = "user_comment"
        app_label = "StudyPlatform"


class PlayHistory(models.Model):
    courses = models.ForeignKey(Courses)
    user = models.ForeignKey(User)
    play_time = models.DateTimeField()

    class Meta:
        managed = False
        db_table = "play_history"
        app_label = "StudyPlatform"
